#!/bin/bash

echo
echo "Fetching public key for Afrimesh PPA"
echo
wget -O - "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0xCDADDFEB382AF1D2" | sudo apt-key add -


echo
echo "Adding Afrimesh PPA to sources.list"
echo
echo "deb http://ppa.launchpad.net/antoine-7degrees/ppa/ubuntu hardy main" >> /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/antoine-7degrees/ppa/ubuntu hardy main" >> /etc/apt/sources.list


echo
echo "Updating package repositories"
echo
apt-get update 


echo
echo "Upgrading base distribution"
echo
apt-get --yes dist-upgrade 


echo
echo "Installing packages"
echo

# - tools --------------------------------------------------------------------
apt-get --yes install emacs22-nox


# - prerequisites ------------------------------------------------------------

# - LAMP
apt-get --yes install apache2
echo "EnableSendfile off" >> /etc/apache2/httpd.conf   # See: http://nixforums.org/about127225.html  TODO - keep an eye on this 
apt-get --yes install php5 
apt-get --yes install libdbd-mysql-perl libdbi-perl libmysqlclient15off \
                      libnet-daemon-perl libplrpc-perl mysql-client-5.0 \
                      mysql-common
MYSQL_PASSWORD=password # TODO - strategy for password-capture/generation
echo "Setting mysql password to: $MYSQL_PASSWORD"
echo "mysql-server-5.0 mysql-server/root_password password $MYSQL_PASSWORD"        | debconf-set-selections
echo "mysql-server-5.0 mysql-server/root_password_again password $MYSQL_PASSWORD"  | debconf-set-selections
apt-get --yes install mysql-server-5.0



# - server and network management --------------------------------------------



# - bandwidth management  ----------------------------------------------------

# transparent proxy

# shaping / balancing




# - billing ------------------------------------------------------------------

# authentication
apt-get -y install freeradius freeradius-mysql 


# - remote provisioning ------------------------------------------------------




# - wispinabox management dashboard ------------------------------------------
dpkg -i /var/cache/apt/archives/wispinabox-dashboard_0.1-1_i386.deb

